
<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta charset="utf-8" />
    <title>Introduction to atomman: Basic support and analysis tools &#8212; atomman 1.4.0 documentation</title>
    <link rel="stylesheet" href="../_static/basic.css" type="text/css" />
    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
    <script type="text/javascript" id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script>
    <script type="text/javascript" src="../_static/jquery.js"></script>
    <script type="text/javascript" src="../_static/underscore.js"></script>
    <script type="text/javascript" src="../_static/doctools.js"></script>
    <script type="text/javascript" src="../_static/language_data.js"></script>
    <script crossorigin="anonymous" integrity="sha256-Ae2Vz/4ePdIu6ZyI/5ZGsYnb+m0JlOmKPjt6XZ9JJkA=" type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.4/require.min.js"></script>
    <script async="async" type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/latest.js?config=TeX-AMS-MML_HTMLorMML"></script>
    <script type="text/x-mathjax-config">MathJax.Hub.Config({"tex2jax": {"inlineMath": [["$", "$"], ["\\(", "\\)"]], "processEscapes": true, "ignoreClass": "document", "processClass": "math|output_area"}})</script>
    <link rel="index" title="Index" href="../genindex.html" />
    <link rel="search" title="Search" href="../search.html" />
    <link rel="next" title="Introduction to atomman: ElasticConstants class" href="3.1._ElasticConstants_class.html" />
    <link rel="prev" title="Introduction to atomman: Running LAMMPS and the Log class" href="2.2._Running_LAMMPS_and_the_Log_class.html" /> 
  </head><body>
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="3.1._ElasticConstants_class.html" title="Introduction to atomman: ElasticConstants class"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="2.2._Running_LAMMPS_and_the_Log_class.html" title="Introduction to atomman: Running LAMMPS and the Log class"
             accesskey="P">previous</a> |</li>
        <li class="nav-item nav-item-0"><a href="../index.html">atomman 1.4.0 documentation</a> &#187;</li>
          <li class="nav-item nav-item-1"><a href="index.html" accesskey="U">Tutorials</a> &#187;</li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body" role="main">
            
  
<style>
/* CSS for nbsphinx extension */

/* remove conflicting styling from Sphinx themes */
div.nbinput.container div.prompt *,
div.nboutput.container div.prompt *,
div.nbinput.container div.input_area pre,
div.nboutput.container div.output_area pre,
div.nbinput.container div.input_area .highlight,
div.nboutput.container div.output_area .highlight {
    border: none;
    padding: 0;
    margin: 0;
    box-shadow: none;
}

div.nbinput.container > div[class*=highlight],
div.nboutput.container > div[class*=highlight] {
    margin: 0;
}

div.nbinput.container div.prompt *,
div.nboutput.container div.prompt * {
    background: none;
}

div.nboutput.container div.output_area .highlight,
div.nboutput.container div.output_area pre {
    background: unset;
}

div.nboutput.container div.output_area div.highlight {
    color: unset;  /* override Pygments text color */
}

/* avoid gaps between output lines */
div.nboutput.container div[class*=highlight] pre {
    line-height: normal;
}

/* input/output containers */
div.nbinput.container,
div.nboutput.container {
    display: -webkit-flex;
    display: flex;
    align-items: flex-start;
    margin: 0;
    width: 100%;
}
@media (max-width: 540px) {
    div.nbinput.container,
    div.nboutput.container {
        flex-direction: column;
    }
}

/* input container */
div.nbinput.container {
    padding-top: 5px;
}

/* last container */
div.nblast.container {
    padding-bottom: 5px;
}

/* input prompt */
div.nbinput.container div.prompt pre {
    color: #307FC1;
}

/* output prompt */
div.nboutput.container div.prompt pre {
    color: #BF5B3D;
}

/* all prompts */
div.nbinput.container div.prompt,
div.nboutput.container div.prompt {
    width: 4.5ex;
    padding-top: 5px;
    position: relative;
    user-select: none;
}

div.nbinput.container div.prompt > div,
div.nboutput.container div.prompt > div {
    position: absolute;
    right: 0;
    margin-right: 0.3ex;
}

@media (max-width: 540px) {
    div.nbinput.container div.prompt,
    div.nboutput.container div.prompt {
        width: unset;
        text-align: left;
        padding: 0.4em;
    }
    div.nboutput.container div.prompt.empty {
        padding: 0;
    }

    div.nbinput.container div.prompt > div,
    div.nboutput.container div.prompt > div {
        position: unset;
    }
}

/* disable scrollbars on prompts */
div.nbinput.container div.prompt pre,
div.nboutput.container div.prompt pre {
    overflow: hidden;
}

/* input/output area */
div.nbinput.container div.input_area,
div.nboutput.container div.output_area {
    -webkit-flex: 1;
    flex: 1;
    overflow: auto;
}
@media (max-width: 540px) {
    div.nbinput.container div.input_area,
    div.nboutput.container div.output_area {
        width: 100%;
    }
}

/* input area */
div.nbinput.container div.input_area {
    border: 1px solid #e0e0e0;
    border-radius: 2px;
    /*background: #f5f5f5;*/
}

/* override MathJax center alignment in output cells */
div.nboutput.container div[class*=MathJax] {
    text-align: left !important;
}

/* override sphinx.ext.imgmath center alignment in output cells */
div.nboutput.container div.math p {
    text-align: left;
}

/* standard error */
div.nboutput.container div.output_area.stderr {
    background: #fdd;
}

/* ANSI colors */
.ansi-black-fg { color: #3E424D; }
.ansi-black-bg { background-color: #3E424D; }
.ansi-black-intense-fg { color: #282C36; }
.ansi-black-intense-bg { background-color: #282C36; }
.ansi-red-fg { color: #E75C58; }
.ansi-red-bg { background-color: #E75C58; }
.ansi-red-intense-fg { color: #B22B31; }
.ansi-red-intense-bg { background-color: #B22B31; }
.ansi-green-fg { color: #00A250; }
.ansi-green-bg { background-color: #00A250; }
.ansi-green-intense-fg { color: #007427; }
.ansi-green-intense-bg { background-color: #007427; }
.ansi-yellow-fg { color: #DDB62B; }
.ansi-yellow-bg { background-color: #DDB62B; }
.ansi-yellow-intense-fg { color: #B27D12; }
.ansi-yellow-intense-bg { background-color: #B27D12; }
.ansi-blue-fg { color: #208FFB; }
.ansi-blue-bg { background-color: #208FFB; }
.ansi-blue-intense-fg { color: #0065CA; }
.ansi-blue-intense-bg { background-color: #0065CA; }
.ansi-magenta-fg { color: #D160C4; }
.ansi-magenta-bg { background-color: #D160C4; }
.ansi-magenta-intense-fg { color: #A03196; }
.ansi-magenta-intense-bg { background-color: #A03196; }
.ansi-cyan-fg { color: #60C6C8; }
.ansi-cyan-bg { background-color: #60C6C8; }
.ansi-cyan-intense-fg { color: #258F8F; }
.ansi-cyan-intense-bg { background-color: #258F8F; }
.ansi-white-fg { color: #C5C1B4; }
.ansi-white-bg { background-color: #C5C1B4; }
.ansi-white-intense-fg { color: #A1A6B2; }
.ansi-white-intense-bg { background-color: #A1A6B2; }

.ansi-default-inverse-fg { color: #FFFFFF; }
.ansi-default-inverse-bg { background-color: #000000; }

.ansi-bold { font-weight: bold; }
.ansi-underline { text-decoration: underline; }


div.nbinput.container div.input_area div[class*=highlight] > pre,
div.nboutput.container div.output_area div[class*=highlight] > pre,
div.nboutput.container div.output_area div[class*=highlight].math,
div.nboutput.container div.output_area.rendered_html,
div.nboutput.container div.output_area > div.output_javascript,
div.nboutput.container div.output_area:not(.rendered_html) > img{
    padding: 5px;
    margin: 0;
}

/* fix copybtn overflow problem in chromium (needed for 'sphinx_copybutton') */
div.nbinput.container div.input_area > div[class^='highlight'],
div.nboutput.container div.output_area > div[class^='highlight']{
    overflow-y: hidden;
}

/* hide copybtn icon on prompts (needed for 'sphinx_copybutton') */
.prompt a.copybtn {
    display: none;
}

/* Some additional styling taken form the Jupyter notebook CSS */
div.rendered_html table {
  border: none;
  border-collapse: collapse;
  border-spacing: 0;
  color: black;
  font-size: 12px;
  table-layout: fixed;
}
div.rendered_html thead {
  border-bottom: 1px solid black;
  vertical-align: bottom;
}
div.rendered_html tr,
div.rendered_html th,
div.rendered_html td {
  text-align: right;
  vertical-align: middle;
  padding: 0.5em 0.5em;
  line-height: normal;
  white-space: normal;
  max-width: none;
  border: none;
}
div.rendered_html th {
  font-weight: bold;
}
div.rendered_html tbody tr:nth-child(odd) {
  background: #f5f5f5;
}
div.rendered_html tbody tr:hover {
  background: rgba(66, 165, 245, 0.2);
}
</style>
<div class="section" id="Introduction-to-atomman:-Basic-support-and-analysis-tools">
<h1>Introduction to atomman: Basic support and analysis tools<a class="headerlink" href="#Introduction-to-atomman:-Basic-support-and-analysis-tools" title="Permalink to this headline">¶</a></h1>
<p><strong>Lucas M. Hale</strong>, <a class="reference external" href="mailto:lucas&#46;hale&#37;&#52;&#48;nist&#46;gov?Subject=ipr-demo">lucas<span>&#46;</span>hale<span>&#64;</span>nist<span>&#46;</span>gov</a>, <em>Materials Science and Engineering Division, NIST</em>.</p>
<p><a class="reference external" href="http://www.nist.gov/public_affairs/disclaimer.cfm">Disclaimers</a></p>
<div class="section" id="1.-Introduction">
<h2>1. Introduction<a class="headerlink" href="#1.-Introduction" title="Permalink to this headline">¶</a></h2>
<p>This Notebook outlines some of the other tools in atomman that provide basic support features and simple analysis of the atomistic systems.</p>
<p><strong>Library Imports</strong></p>
<div class="nbinput docutils container">
<div class="prompt highlight-none notranslate"><div class="highlight"><pre><span></span>[1]:
</pre></div>
</div>
<div class="input_area highlight-ipython3 notranslate"><div class="highlight"><pre>
<span></span><span class="c1"># Standard Python libraries</span>
<span class="kn">import</span> <span class="nn">os</span>
<span class="kn">from</span> <span class="nn">io</span> <span class="k">import</span> <span class="nb">open</span>
<span class="kn">from</span> <span class="nn">copy</span> <span class="k">import</span> <span class="n">deepcopy</span>
<span class="kn">import</span> <span class="nn">datetime</span>

<span class="c1"># http://www.numpy.org/</span>
<span class="kn">import</span> <span class="nn">numpy</span> <span class="k">as</span> <span class="nn">np</span>

<span class="c1"># https://pandas.pydata.org/</span>
<span class="kn">import</span> <span class="nn">pandas</span> <span class="k">as</span> <span class="nn">pd</span>

<span class="c1"># https://github.com/usnistgov/atomman</span>
<span class="kn">import</span> <span class="nn">atomman</span> <span class="k">as</span> <span class="nn">am</span>
<span class="kn">import</span> <span class="nn">atomman.unitconvert</span> <span class="k">as</span> <span class="nn">uc</span>

<span class="c1"># Show atomman version</span>
<span class="nb">print</span><span class="p">(</span><span class="s1">&#39;atomman version =&#39;</span><span class="p">,</span> <span class="n">am</span><span class="o">.</span><span class="n">__version__</span><span class="p">)</span>

<span class="c1"># Show date of Notebook execution</span>
<span class="nb">print</span><span class="p">(</span><span class="s1">&#39;Notebook executed on&#39;</span><span class="p">,</span> <span class="n">datetime</span><span class="o">.</span><span class="n">date</span><span class="o">.</span><span class="n">today</span><span class="p">())</span>
</pre></div>
</div>
</div>
<div class="nboutput nblast docutils container">
<div class="prompt empty docutils container">
</div>
<div class="output_area docutils container">
<div class="highlight"><pre>
atomman version = 1.4.0
Notebook executed on 2021-08-05
</pre></div></div>
</div>
<p>Construct a demonstration 2x2x2 diamond cubic silicon system</p>
<div class="nbinput docutils container">
<div class="prompt highlight-none notranslate"><div class="highlight"><pre><span></span>[2]:
</pre></div>
</div>
<div class="input_area highlight-ipython3 notranslate"><div class="highlight"><pre>
<span></span><span class="n">a</span> <span class="o">=</span> <span class="n">uc</span><span class="o">.</span><span class="n">set_in_units</span><span class="p">(</span><span class="mf">5.431</span><span class="p">,</span> <span class="s1">&#39;angstrom&#39;</span><span class="p">)</span>
<span class="n">ucell</span> <span class="o">=</span> <span class="n">am</span><span class="o">.</span><span class="n">load</span><span class="p">(</span><span class="s1">&#39;prototype&#39;</span><span class="p">,</span> <span class="s1">&#39;A4--C--dc&#39;</span><span class="p">,</span> <span class="n">a</span><span class="o">=</span><span class="n">a</span><span class="p">,</span> <span class="n">symbols</span><span class="o">=</span><span class="s1">&#39;Si&#39;</span><span class="p">)</span>

<span class="n">system</span> <span class="o">=</span> <span class="n">ucell</span><span class="o">.</span><span class="n">supersize</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span><span class="mi">2</span><span class="p">,</span><span class="mi">2</span><span class="p">)</span>

<span class="nb">print</span><span class="p">(</span><span class="n">system</span><span class="o">.</span><span class="n">natoms</span><span class="p">)</span>
</pre></div>
</div>
</div>
<div class="nboutput nblast docutils container">
<div class="prompt empty docutils container">
</div>
<div class="output_area docutils container">
<div class="highlight"><pre>
64
</pre></div></div>
</div>
</div>
<div class="section" id="2.-Elastic-constants">
<h2>2. Elastic constants<a class="headerlink" href="#2.-Elastic-constants" title="Permalink to this headline">¶</a></h2>
<p>The full elastic constants tensor for a given crystal can be represented with the atomman.ElasticConstants class. The values in an ElasticConstants object can be set and retrieved in a variety of formats and transformed to other Cartesian coordinate systems.</p>
<p>See the <a class="reference external" href="3.1._ElasticConstants_class.html">3.1. ElasticConstants class Jupyter Notebook</a> for more details and a full description of all of the class methods.</p>
<div class="nbinput nblast docutils container">
<div class="prompt highlight-none notranslate"><div class="highlight"><pre><span></span>[3]:
</pre></div>
</div>
<div class="input_area highlight-ipython3 notranslate"><div class="highlight"><pre>
<span></span><span class="c1"># Define an ElasticConstants object for diamond cubic silicon</span>
<span class="c1"># values taken from http://www.ioffe.ru/SVA/NSM/Semicond/Si/mechanic.html</span>
<span class="n">C11</span> <span class="o">=</span> <span class="n">uc</span><span class="o">.</span><span class="n">set_in_units</span><span class="p">(</span><span class="mf">16.60</span> <span class="o">*</span> <span class="mi">10</span><span class="o">**</span><span class="mi">11</span><span class="p">,</span> <span class="s1">&#39;dyn/cm^2&#39;</span><span class="p">)</span>
<span class="n">C12</span> <span class="o">=</span> <span class="n">uc</span><span class="o">.</span><span class="n">set_in_units</span><span class="p">(</span> <span class="mf">6.40</span> <span class="o">*</span> <span class="mi">10</span><span class="o">**</span><span class="mi">11</span><span class="p">,</span> <span class="s1">&#39;dyn/cm^2&#39;</span><span class="p">)</span>
<span class="n">C44</span> <span class="o">=</span> <span class="n">uc</span><span class="o">.</span><span class="n">set_in_units</span><span class="p">(</span> <span class="mf">7.96</span> <span class="o">*</span> <span class="mi">10</span><span class="o">**</span><span class="mi">11</span><span class="p">,</span> <span class="s1">&#39;dyn/cm^2&#39;</span><span class="p">)</span>

<span class="n">C</span> <span class="o">=</span> <span class="n">am</span><span class="o">.</span><span class="n">ElasticConstants</span><span class="p">(</span><span class="n">C11</span><span class="o">=</span><span class="n">C11</span><span class="p">,</span> <span class="n">C12</span><span class="o">=</span><span class="n">C12</span><span class="p">,</span> <span class="n">C44</span><span class="o">=</span><span class="n">C44</span><span class="p">)</span>
</pre></div>
</div>
</div>
<div class="nbinput docutils container">
<div class="prompt highlight-none notranslate"><div class="highlight"><pre><span></span>[4]:
</pre></div>
</div>
<div class="input_area highlight-ipython3 notranslate"><div class="highlight"><pre>
<span></span><span class="c1"># Get 6x6 Cij Voigt representation of elastic constants in GPa</span>
<span class="nb">print</span><span class="p">(</span><span class="s1">&#39;Cij (GPa) =&#39;</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="n">uc</span><span class="o">.</span><span class="n">get_in_units</span><span class="p">(</span><span class="n">C</span><span class="o">.</span><span class="n">Cij</span><span class="p">,</span> <span class="s1">&#39;GPa&#39;</span><span class="p">))</span>
</pre></div>
</div>
</div>
<div class="nboutput nblast docutils container">
<div class="prompt empty docutils container">
</div>
<div class="output_area docutils container">
<div class="highlight"><pre>
Cij (GPa) =
[[166.   64.   64.    0.    0.    0. ]
 [ 64.  166.   64.    0.    0.    0. ]
 [ 64.   64.  166.    0.    0.    0. ]
 [  0.    0.    0.   79.6   0.    0. ]
 [  0.    0.    0.    0.   79.6   0. ]
 [  0.    0.    0.    0.    0.   79.6]]
</pre></div></div>
</div>
</div>
<div class="section" id="3.-Relative-distances-between-atoms">
<h2>3. Relative distances between atoms<a class="headerlink" href="#3.-Relative-distances-between-atoms" title="Permalink to this headline">¶</a></h2>
<p>There are a few built-in tools for investigating the relative positions between atoms of the same and different systems.</p>
<div class="section" id="3.1.-System.dvect()">
<h3>3.1. System.dvect()<a class="headerlink" href="#3.1.-System.dvect()" title="Permalink to this headline">¶</a></h3>
<p>The System.dvect() method computes the shortest vector(s) between two points or list of points within the System taking into account the System’s periodic dimensions.</p>
<p>Parameters</p>
<ul class="simple">
<li><p><strong>pos_0</strong> (<em>numpy.ndarray or index</em>) Absolute Cartesian vector position(s) to use as reference point(s). If the value can be used as an index, then self.atoms.pos[pos_0] is taken.</p></li>
<li><p><strong>pos_1</strong> (<em>numpy.ndarray or index</em>) Absolute Cartesian vector position(s) to find relative to pos_0. If the value can be used as an index, then self.atoms.pos[pos_1] is taken.</p></li>
</ul>
<div class="nbinput docutils container">
<div class="prompt highlight-none notranslate"><div class="highlight"><pre><span></span>[5]:
</pre></div>
</div>
<div class="input_area highlight-ipython3 notranslate"><div class="highlight"><pre>
<span></span><span class="c1"># Calculate shortest vector between atoms 1 and 60</span>
<span class="nb">print</span><span class="p">(</span><span class="n">system</span><span class="o">.</span><span class="n">dvect</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">60</span><span class="p">))</span>
</pre></div>
</div>
</div>
<div class="nboutput nblast docutils container">
<div class="prompt empty docutils container">
</div>
<div class="output_area docutils container">
<div class="highlight"><pre>
[ 4.07325  4.07325 -4.07325]
</pre></div></div>
</div>
</div>
<div class="section" id="3.2.-System.dmag()">
<h3>3.2. System.dmag()<a class="headerlink" href="#3.2.-System.dmag()" title="Permalink to this headline">¶</a></h3>
<p>The System dmag() method computes the magnitude of the shortest vector(s) between two points or list of points within the System taking into account the System’s periodic dimensions. This is identical to computing dvect above, then finding the magnitude of those vectors, but should be faster.</p>
<div class="nbinput docutils container">
<div class="prompt highlight-none notranslate"><div class="highlight"><pre><span></span>[6]:
</pre></div>
</div>
<div class="input_area highlight-ipython3 notranslate"><div class="highlight"><pre>
<span></span><span class="c1"># Calculate shortest distance between position [5., 5., 5.] and all atoms in system</span>
<span class="n">dmags</span> <span class="o">=</span> <span class="n">system</span><span class="o">.</span><span class="n">dmag</span><span class="p">([</span><span class="mf">5.0</span><span class="p">,</span> <span class="mf">5.0</span><span class="p">,</span> <span class="mf">5.0</span><span class="p">],</span> <span class="nb">range</span><span class="p">(</span><span class="n">system</span><span class="o">.</span><span class="n">natoms</span><span class="p">))</span>
<span class="nb">print</span><span class="p">(</span><span class="n">dmags</span><span class="p">)</span>
</pre></div>
</div>
</div>
<div class="nboutput nblast docutils container">
<div class="prompt empty docutils container">
</div>
<div class="output_area docutils container">
<div class="highlight"><pre>
[8.66025404 5.95297241 5.95297241 5.95297241 6.30856205 3.87088054
 3.87088054 3.87088054 7.08419092 6.33398788 6.33398788 3.25939281
 5.45266877 2.2175116  5.86626957 5.86626957 7.08419092 6.33398788
 3.25939281 6.33398788 5.45266877 5.86626957 2.2175116  5.86626957
 5.03701519 6.69334927 3.91218142 3.91218142 4.43455051 4.93424363
 4.93424363 7.33774633 7.08419092 3.25939281 6.33398788 6.33398788
 5.45266877 5.86626957 5.86626957 2.2175116  5.03701519 3.91218142
 6.69334927 3.91218142 4.43455051 4.93424363 7.33774633 4.93424363
 5.03701519 3.91218142 3.91218142 6.69334927 4.43455051 7.33774633
 4.93424363 4.93424363 0.7465139  4.4706471  4.4706471  4.4706471
 3.09820588 6.6163557  6.6163557  6.6163557 ]
</pre></div></div>
</div>
</div>
<div class="section" id="3.3.-displacement()">
<h3>3.3. displacement()<a class="headerlink" href="#3.3.-displacement()" title="Permalink to this headline">¶</a></h3>
<p>The atomman.displacement() function compares two systems with the same number of atoms and calculates the vector differences between all atoms with the same atomic id’s. The vectors returned are the shortest vectors after taking periodic boundaries in consideration, i.e. it uses dvect().</p>
<p>Parameters</p>
<ul class="simple">
<li><p><strong>system_0</strong> (<em>atomman.System</em>) The initial system to calculate displacements from.</p></li>
<li><p><strong>system_1</strong> (<em>atomman.System</em>) The final system to calculate displacements to.</p></li>
<li><p><strong>box_reference</strong> (<em>str or None</em>) Specifies which system’s boundary conditions to use.</p>
<ul>
<li><p>‘initial’ uses system_0’s box and pbc.</p></li>
<li><p>‘final’ uses system_1’s box and pbc (Default).</p></li>
<li><p>None computes the straight difference between the positions without accounting for periodic boundaries.</p></li>
</ul>
</li>
</ul>
<div class="nbinput docutils container">
<div class="prompt highlight-none notranslate"><div class="highlight"><pre><span></span>[7]:
</pre></div>
</div>
<div class="input_area highlight-ipython3 notranslate"><div class="highlight"><pre>
<span></span><span class="c1"># Copy system and randomly displace atoms</span>
<span class="n">system2</span> <span class="o">=</span> <span class="n">deepcopy</span><span class="p">(</span><span class="n">system</span><span class="p">)</span>
<span class="n">system2</span><span class="o">.</span><span class="n">atoms</span><span class="o">.</span><span class="n">pos</span> <span class="o">+=</span> <span class="mi">3</span> <span class="o">*</span> <span class="n">np</span><span class="o">.</span><span class="n">random</span><span class="o">.</span><span class="n">rand</span><span class="p">(</span><span class="n">system</span><span class="o">.</span><span class="n">natoms</span><span class="p">,</span> <span class="mi">3</span><span class="p">)</span>
<span class="n">system2</span><span class="o">.</span><span class="n">wrap</span><span class="p">()</span>

<span class="c1"># Show displacement between the two systems</span>
<span class="nb">print</span><span class="p">(</span><span class="n">am</span><span class="o">.</span><span class="n">displacement</span><span class="p">(</span><span class="n">system</span><span class="p">,</span> <span class="n">system2</span><span class="p">))</span>
</pre></div>
</div>
</div>
<div class="nboutput nblast docutils container">
<div class="prompt empty docutils container">
</div>
<div class="output_area docutils container">
<div class="highlight"><pre>
[[0.99603857 1.43863724 0.591721  ]
 [1.72792262 0.61085361 1.70718691]
 [0.15549565 0.92514288 2.61097281]
 [1.41569634 0.90522856 1.68847287]
 [1.81424267 0.56808247 2.18561857]
 [2.72553133 2.13598235 2.74308199]
 [1.29520816 2.46282183 2.21613065]
 [2.90929418 1.73635724 0.41017354]
 [1.76887711 2.85857528 2.65185785]
 [0.26059387 1.02830317 0.77041408]
 [1.27722693 2.63985422 1.0868175 ]
 [2.64540753 2.67385585 0.48848634]
 [2.88070417 2.91077294 1.92749443]
 [0.69530365 2.35475947 0.46623167]
 [1.84750822 2.9051281  0.3921404 ]
 [0.64373951 0.24626612 0.8194635 ]
 [1.89782266 2.66502855 0.46479666]
 [1.7791236  0.22940824 0.36557604]
 [2.05966212 0.88053363 0.27463514]
 [0.99311977 0.48984318 0.38610387]
 [0.50177108 1.85573905 2.17549783]
 [2.00151313 1.11888152 1.91759207]
 [2.82831279 0.51041983 0.43659667]
 [0.16477686 1.31245116 1.84300738]
 [1.14831696 0.89599073 0.94318064]
 [0.40920217 2.69268077 0.92314081]
 [1.92433531 0.43145832 2.57552459]
 [1.29957253 0.52358684 2.54466927]
 [0.37003548 0.80561067 2.4623484 ]
 [0.71855465 2.70688489 2.43903939]
 [0.04998238 0.99324663 0.62647591]
 [1.40175192 1.91228962 0.14133925]
 [0.873906   0.73383899 1.67054587]
 [2.91306592 2.15287323 2.97282268]
 [2.48032709 1.18365632 0.97460698]
 [2.87915574 1.52372723 0.02143964]
 [0.18544469 0.21583727 2.94958799]
 [2.9889433  0.34263071 2.15844326]
 [2.68588446 1.59649889 1.6853371 ]
 [2.85236091 1.28573587 2.12574881]
 [0.70070409 0.79190137 0.71048702]
 [1.50671995 2.64742722 1.4868234 ]
 [0.96455881 0.20132281 2.3701744 ]
 [2.44793886 0.87574734 1.39985676]
 [1.45910007 1.68904979 0.92585075]
 [0.16827792 0.25317677 2.4503324 ]
 [2.04055577 0.91133765 1.99867685]
 [0.13699851 0.32462108 0.5213217 ]
 [0.8698135  2.96181797 0.83466607]
 [0.70480033 0.79672071 1.19483379]
 [2.99017617 0.93501253 0.74366069]
 [1.03433172 0.09130963 0.38036951]
 [0.19494491 0.61943101 2.85282479]
 [1.3757641  1.625531   0.89416238]
 [0.19562443 0.77011829 1.51996765]
 [2.2330411  0.94005377 2.51933319]
 [1.29213491 0.70965131 0.31615813]
 [2.77540236 0.85584758 0.64817984]
 [0.20847362 2.39985079 1.73414601]
 [0.78406961 2.0580142  1.25450911]
 [1.98109968 1.63475414 0.67012227]
 [0.37131018 0.41426808 2.09247931]
 [0.83840685 0.07476563 0.8252753 ]
 [1.06777949 2.27272563 0.38276492]]
</pre></div></div>
</div>
</div>
<div class="section" id="3.4.-System.neighborlist()">
<h3>3.4. System.neighborlist()<a class="headerlink" href="#3.4.-System.neighborlist()" title="Permalink to this headline">¶</a></h3>
<p>A list of neighbor atoms within a cutoff can be constructed using the System.neighborlist() method. The list of neighbors is returned as an atomman.NeighborList object.</p>
<p>See the <a class="reference external" href="3.2._NeighborList_class.html">3.2. NeighborList class Jupyter Notebook</a> for more details on how the list is calculated and can be used.</p>
<p>Parameters</p>
<ul class="simple">
<li><p><strong>cutoff</strong> (<em>float, optional</em>) Radial cutoff distance for identifying neighbors. Must be given if model is not given.</p></li>
<li><p><strong>model</strong> (<em>str or file-like object, optional</em>) Gives the file path or content to load. If given, no other parameters are allowed.</p></li>
<li><p><strong>initialsize</strong> (<em>int, optional</em>) The number of neighbor positions to initially assign to each atom. Default value is 20.</p></li>
<li><p><strong>deltasize</strong> (<em>int, optional</em>) Specifies the number of extra neighbor positions to allow each atom when the number of neighbors exceeds the underlying array size. Default value is 10.</p></li>
</ul>
<p>Returns</p>
<ul class="simple">
<li><p>(<em>atomman.NeighborList</em>) The compiled list of neighbors.</p></li>
</ul>
<div class="nbinput nblast docutils container">
<div class="prompt highlight-none notranslate"><div class="highlight"><pre><span></span>[8]:
</pre></div>
</div>
<div class="input_area highlight-ipython3 notranslate"><div class="highlight"><pre>
<span></span><span class="c1"># Identify neighbors within 3 angstroms</span>
<span class="n">neighbors</span> <span class="o">=</span> <span class="n">system</span><span class="o">.</span><span class="n">neighborlist</span><span class="p">(</span><span class="n">cutoff</span><span class="o">=</span><span class="mi">3</span><span class="p">)</span>
</pre></div>
</div>
</div>
<p>The coordinataion numbers for the atoms can be retrieved with coord.</p>
<div class="nbinput docutils container">
<div class="prompt highlight-none notranslate"><div class="highlight"><pre><span></span>[9]:
</pre></div>
</div>
<div class="input_area highlight-ipython3 notranslate"><div class="highlight"><pre>
<span></span><span class="c1"># Show average atomic coordination</span>
<span class="nb">print</span><span class="p">(</span><span class="s1">&#39;Average coordination =&#39;</span><span class="p">,</span> <span class="n">neighbors</span><span class="o">.</span><span class="n">coord</span><span class="o">.</span><span class="n">mean</span><span class="p">())</span>
</pre></div>
</div>
</div>
<div class="nboutput nblast docutils container">
<div class="prompt empty docutils container">
</div>
<div class="output_area docutils container">
<div class="highlight"><pre>
Average coordination = 4.0
</pre></div></div>
</div>
<p>Index selection on the NeighborList object will return the indices of the neighbor atoms.</p>
<div class="nbinput docutils container">
<div class="prompt highlight-none notranslate"><div class="highlight"><pre><span></span>[10]:
</pre></div>
</div>
<div class="input_area highlight-ipython3 notranslate"><div class="highlight"><pre>
<span></span><span class="c1"># List neighbor atoms of atom 6</span>
<span class="nb">print</span><span class="p">(</span><span class="s1">&#39;Neighbors of atom 6 =&#39;</span><span class="p">,</span> <span class="n">neighbors</span><span class="p">[</span><span class="mi">6</span><span class="p">])</span>
</pre></div>
</div>
</div>
<div class="nboutput nblast docutils container">
<div class="prompt empty docutils container">
</div>
<div class="output_area docutils container">
<div class="highlight"><pre>
Neighbors of atom 6 = [ 2 11 33 40]
</pre></div></div>
</div>
<p>The neighbor indices can then be used to filter other properties to only focus on an atom’s neighbors.</p>
<div class="nbinput docutils container">
<div class="prompt highlight-none notranslate"><div class="highlight"><pre><span></span>[11]:
</pre></div>
</div>
<div class="input_area highlight-ipython3 notranslate"><div class="highlight"><pre>
<span></span><span class="c1"># List the dmag values between atom 9 and its neighbors</span>
<span class="nb">print</span><span class="p">(</span><span class="n">system</span><span class="o">.</span><span class="n">dmag</span><span class="p">(</span><span class="mi">9</span><span class="p">,</span> <span class="n">neighbors</span><span class="p">[</span><span class="mi">9</span><span class="p">]))</span>
</pre></div>
</div>
</div>
<div class="nboutput nblast docutils container">
<div class="prompt empty docutils container">
</div>
<div class="output_area docutils container">
<div class="highlight"><pre>
[2.35169198 2.35169198 2.35169198 2.35169198]
</pre></div></div>
</div>
</div>
</div>
<div class="section" id="4.-Region-selectors">
<h2>4. Region selectors<a class="headerlink" href="#4.-Region-selectors" title="Permalink to this headline">¶</a></h2>
<p><em>Added version 1.3.0</em></p>
<p>A number of geometric shape definitions are available in the atomman.region submodule to help identify regions in space above/below planes or inside/outside of regions. These are useful for constructing systems by slicing away atoms to create nanostructures, or for performing analysis on only select regions.</p>
<p>See the <a class="reference external" href="3.3._Region_selectors.html">3.3. Region selectors Jupyter Notebook</a> for more details and a list of all available shapes.</p>
<div class="nbinput docutils container">
<div class="prompt highlight-none notranslate"><div class="highlight"><pre><span></span>[12]:
</pre></div>
</div>
<div class="input_area highlight-ipython3 notranslate"><div class="highlight"><pre>
<span></span><span class="c1"># Define a plane normal to the y axis and positioned halfway across system</span>
<span class="n">plane</span> <span class="o">=</span> <span class="n">am</span><span class="o">.</span><span class="n">region</span><span class="o">.</span><span class="n">Plane</span><span class="p">([</span><span class="mi">0</span><span class="p">,</span><span class="mi">1</span><span class="p">,</span><span class="mi">0</span><span class="p">],</span> <span class="n">system</span><span class="o">.</span><span class="n">box</span><span class="o">.</span><span class="n">bvect</span> <span class="o">/</span> <span class="mi">2</span><span class="p">)</span>

<span class="c1"># Count number of atoms in system, and above/below plane</span>
<span class="nb">print</span><span class="p">(</span><span class="n">f</span><span class="s1">&#39;</span><span class="si">{system.natoms}</span><span class="s1"> atoms in system&#39;</span><span class="p">)</span>

<span class="n">abovecount</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">sum</span><span class="p">(</span><span class="n">plane</span><span class="o">.</span><span class="n">above</span><span class="p">(</span><span class="n">system</span><span class="o">.</span><span class="n">atoms</span><span class="o">.</span><span class="n">pos</span><span class="p">))</span>
<span class="nb">print</span><span class="p">(</span><span class="n">f</span><span class="s1">&#39;</span><span class="si">{abovecount}</span><span class="s1"> atoms above plane&#39;</span><span class="p">)</span>

<span class="n">belowcount</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">sum</span><span class="p">(</span><span class="n">plane</span><span class="o">.</span><span class="n">below</span><span class="p">(</span><span class="n">system</span><span class="o">.</span><span class="n">atoms</span><span class="o">.</span><span class="n">pos</span><span class="p">))</span>
<span class="nb">print</span><span class="p">(</span><span class="n">f</span><span class="s1">&#39;</span><span class="si">{belowcount}</span><span class="s1"> atoms below plane&#39;</span><span class="p">)</span>

<span class="c1"># Define a sphere centered at [0,0,0] with radius = 6</span>
<span class="n">sphere</span> <span class="o">=</span> <span class="n">am</span><span class="o">.</span><span class="n">region</span><span class="o">.</span><span class="n">Sphere</span><span class="p">([</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">],</span> <span class="mi">6</span><span class="p">)</span>

<span class="c1"># Count atoms inside sphere</span>
<span class="n">insidecount</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">sum</span><span class="p">(</span><span class="n">sphere</span><span class="o">.</span><span class="n">inside</span><span class="p">(</span><span class="n">system</span><span class="o">.</span><span class="n">atoms</span><span class="o">.</span><span class="n">pos</span><span class="p">))</span>
<span class="nb">print</span><span class="p">(</span><span class="n">f</span><span class="s1">&#39;</span><span class="si">{insidecount}</span><span class="s1"> atoms inside sphere&#39;</span><span class="p">)</span>
</pre></div>
</div>
</div>
<div class="nboutput nblast docutils container">
<div class="prompt empty docutils container">
</div>
<div class="output_area docutils container">
<div class="highlight"><pre>
64 atoms in system
24 atoms above plane
40 atoms below plane
11 atoms inside sphere
</pre></div></div>
</div>
</div>
<div class="section" id="5.-Basic-tools">
<h2>5. Basic tools<a class="headerlink" href="#5.-Basic-tools" title="Permalink to this headline">¶</a></h2>
<p>This lists some of the other basic tools and features in atomman.</p>
<div class="section" id="5.1.-Atomic-information">
<h3>5.1. Atomic information<a class="headerlink" href="#5.1.-Atomic-information" title="Permalink to this headline">¶</a></h3>
<ul class="simple">
<li><p><strong>atomman.tools.atomic_number()</strong> returns the atomic number associated with an element’s atomic symbol.</p></li>
<li><p><strong>atomman.tools.atomic_symbol()</strong> returns the elemental symbol associated with an given atomic number.</p></li>
<li><p><strong>atomman.tools.atomic_mass()</strong> returns the atomic mass of an element or isotope. The atom can be identified with atomic number or atomic/isotope symbol.</p></li>
</ul>
<div class="nbinput docutils container">
<div class="prompt highlight-none notranslate"><div class="highlight"><pre><span></span>[13]:
</pre></div>
</div>
<div class="input_area highlight-ipython3 notranslate"><div class="highlight"><pre>
<span></span><span class="c1"># Get atomic number for an atomic symbol</span>
<span class="n">num</span> <span class="o">=</span> <span class="n">am</span><span class="o">.</span><span class="n">tools</span><span class="o">.</span><span class="n">atomic_number</span><span class="p">(</span><span class="s1">&#39;Fe&#39;</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="n">num</span><span class="p">)</span>

<span class="c1"># Get atomic symbol for an atomic number</span>
<span class="n">symbol</span> <span class="o">=</span> <span class="n">am</span><span class="o">.</span><span class="n">tools</span><span class="o">.</span><span class="n">atomic_symbol</span><span class="p">(</span><span class="n">num</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="n">symbol</span><span class="p">)</span>

<span class="c1"># Get atomic mass for an atomic symbol</span>
<span class="n">mass</span> <span class="o">=</span> <span class="n">am</span><span class="o">.</span><span class="n">tools</span><span class="o">.</span><span class="n">atomic_mass</span><span class="p">(</span><span class="n">symbol</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="n">mass</span><span class="p">)</span>

<span class="c1"># Get atomic mass for an atomic number</span>
<span class="n">mass</span> <span class="o">=</span> <span class="n">am</span><span class="o">.</span><span class="n">tools</span><span class="o">.</span><span class="n">atomic_mass</span><span class="p">(</span><span class="n">num</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="n">mass</span><span class="p">)</span>
</pre></div>
</div>
</div>
<div class="nboutput nblast docutils container">
<div class="prompt empty docutils container">
</div>
<div class="output_area docutils container">
<div class="highlight"><pre>
26
Fe
55.845
55.845
</pre></div></div>
</div>
<div class="nbinput docutils container">
<div class="prompt highlight-none notranslate"><div class="highlight"><pre><span></span>[14]:
</pre></div>
</div>
<div class="input_area highlight-ipython3 notranslate"><div class="highlight"><pre>
<span></span><span class="c1"># Get atomic mass for an isotope</span>
<span class="n">mass</span> <span class="o">=</span> <span class="n">am</span><span class="o">.</span><span class="n">tools</span><span class="o">.</span><span class="n">atomic_mass</span><span class="p">(</span><span class="s1">&#39;Al-26&#39;</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="n">mass</span><span class="p">)</span>
</pre></div>
</div>
</div>
<div class="nboutput nblast docutils container">
<div class="prompt empty docutils container">
</div>
<div class="output_area docutils container">
<div class="highlight"><pre>
25.986891904
</pre></div></div>
</div>
</div>
<div class="section" id="5.2.-axes_check()">
<h3>5.2. axes_check()<a class="headerlink" href="#5.2.-axes_check()" title="Permalink to this headline">¶</a></h3>
<p>The axes_check() function is useful when working in Cartesian systems. Given a (3,3) array representing three 3D Cartesian vectors:</p>
<ul class="simple">
<li><p>The three vectors are checked that they are orthogonal and right-handed.</p></li>
<li><p>The corresponding array of unit vectors are returned. This can then be used for crystal transformations.</p></li>
</ul>
<div class="nbinput docutils container">
<div class="prompt highlight-none notranslate"><div class="highlight"><pre><span></span>[15]:
</pre></div>
</div>
<div class="input_area highlight-ipython3 notranslate"><div class="highlight"><pre>
<span></span><span class="n">axes</span> <span class="o">=</span> <span class="p">[[</span><span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">],</span>
        <span class="p">[</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">],</span>
        <span class="p">[</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">0</span><span class="p">]]</span>
<span class="nb">print</span><span class="p">(</span><span class="n">am</span><span class="o">.</span><span class="n">tools</span><span class="o">.</span><span class="n">axes_check</span><span class="p">(</span><span class="n">axes</span><span class="p">))</span>
</pre></div>
</div>
</div>
<div class="nboutput nblast docutils container">
<div class="prompt empty docutils container">
</div>
<div class="output_area docutils container">
<div class="highlight"><pre>
[[-0.70710678  0.          0.70710678]
 [ 0.70710678  0.          0.70710678]
 [ 0.          1.          0.        ]]
</pre></div></div>
</div>
</div>
<div class="section" id="5.3.-filltemplate()">
<h3>5.3. filltemplate()<a class="headerlink" href="#5.3.-filltemplate()" title="Permalink to this headline">¶</a></h3>
<p>The filltemplate() function takes a template and fills in values for delimited template variables.</p>
<div class="nbinput docutils container">
<div class="prompt highlight-none notranslate"><div class="highlight"><pre><span></span>[16]:
</pre></div>
</div>
<div class="input_area highlight-ipython3 notranslate"><div class="highlight"><pre>
<span></span><span class="n">madlibs</span> <span class="o">=</span> <span class="s2">&quot;My friend &lt;name&gt; really likes to use templates to &lt;verb&gt;, says that they are &lt;adjective&gt;!&quot;</span>
<span class="n">s_delimiter</span> <span class="o">=</span> <span class="s1">&#39;&lt;&#39;</span>
<span class="n">e_delimiter</span> <span class="o">=</span> <span class="s1">&#39;&gt;&#39;</span>

<span class="n">terms</span> <span class="o">=</span> <span class="p">{}</span>
<span class="n">terms</span><span class="p">[</span><span class="s1">&#39;name&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="s1">&#39;Charlie&#39;</span>
<span class="n">terms</span><span class="p">[</span><span class="s1">&#39;verb&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="s1">&#39;program&#39;</span>
<span class="n">terms</span><span class="p">[</span><span class="s1">&#39;adjective&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="s1">&#39;delicious&#39;</span>

<span class="nb">print</span><span class="p">(</span><span class="n">am</span><span class="o">.</span><span class="n">tools</span><span class="o">.</span><span class="n">filltemplate</span><span class="p">(</span><span class="n">madlibs</span><span class="p">,</span> <span class="n">terms</span><span class="p">,</span> <span class="n">s_delimiter</span><span class="p">,</span> <span class="n">e_delimiter</span><span class="p">))</span>
</pre></div>
</div>
</div>
<div class="nboutput nblast docutils container">
<div class="prompt empty docutils container">
</div>
<div class="output_area docutils container">
<div class="highlight"><pre>
My friend Charlie really likes to use templates to program, says that they are delicious!
</pre></div></div>
</div>
</div>
<div class="section" id="5.4.-indexstr()">
<h3>5.4. indexstr()<a class="headerlink" href="#5.4.-indexstr()" title="Permalink to this headline">¶</a></h3>
<p>Iterates through all indicies of an array with a given shape, returning both the numeric index and a string representation.</p>
<div class="nbinput docutils container">
<div class="prompt highlight-none notranslate"><div class="highlight"><pre><span></span>[17]:
</pre></div>
</div>
<div class="input_area highlight-ipython3 notranslate"><div class="highlight"><pre>
<span></span><span class="k">for</span> <span class="n">index</span><span class="p">,</span> <span class="n">istr</span> <span class="ow">in</span> <span class="n">am</span><span class="o">.</span><span class="n">tools</span><span class="o">.</span><span class="n">indexstr</span><span class="p">((</span><span class="mi">3</span><span class="p">,</span><span class="mi">2</span><span class="p">)):</span>
    <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;index -&gt;&#39;</span><span class="p">,</span> <span class="nb">repr</span><span class="p">(</span><span class="n">index</span><span class="p">),</span> <span class="s1">&#39;, istr -&gt;&#39;</span><span class="p">,</span> <span class="nb">repr</span><span class="p">(</span><span class="n">istr</span><span class="p">))</span>
</pre></div>
</div>
</div>
<div class="nboutput nblast docutils container">
<div class="prompt empty docutils container">
</div>
<div class="output_area docutils container">
<div class="highlight"><pre>
index -&gt; (0, 0) , istr -&gt; &#39;[0][0]&#39;
index -&gt; (0, 1) , istr -&gt; &#39;[0][1]&#39;
index -&gt; (1, 0) , istr -&gt; &#39;[1][0]&#39;
index -&gt; (1, 1) , istr -&gt; &#39;[1][1]&#39;
index -&gt; (2, 0) , istr -&gt; &#39;[2][0]&#39;
index -&gt; (2, 1) , istr -&gt; &#39;[2][1]&#39;
</pre></div></div>
</div>
</div>
<div class="section" id="5.5.-uber_open_rmode">
<h3>5.5. uber_open_rmode<a class="headerlink" href="#5.5.-uber_open_rmode" title="Permalink to this headline">¶</a></h3>
<p>uber_open_rmode is a context manager that allows for similar reading of content from a file or from a string variable. It equivalently handles:</p>
<ul class="simple">
<li><p>str path name to a file</p></li>
<li><p>str content</p></li>
<li><p>open file-like object</p></li>
</ul>
<div class="nbinput docutils container">
<div class="prompt highlight-none notranslate"><div class="highlight"><pre><span></span>[18]:
</pre></div>
</div>
<div class="input_area highlight-ipython3 notranslate"><div class="highlight"><pre>
<span></span><span class="c1"># Define str and save to file</span>
<span class="n">text</span> <span class="o">=</span> <span class="s1">&#39;Here I am, read me!&#39;</span>
<span class="n">fname</span> <span class="o">=</span> <span class="s1">&#39;text.txt&#39;</span>
<span class="k">with</span> <span class="nb">open</span><span class="p">(</span><span class="n">fname</span><span class="p">,</span> <span class="s1">&#39;w&#39;</span><span class="p">)</span> <span class="k">as</span> <span class="n">f</span><span class="p">:</span>
    <span class="n">f</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">text</span><span class="p">)</span>

<span class="c1"># Use uber_open_rmode on text</span>
<span class="k">with</span> <span class="n">am</span><span class="o">.</span><span class="n">tools</span><span class="o">.</span><span class="n">uber_open_rmode</span><span class="p">(</span><span class="n">text</span><span class="p">)</span> <span class="k">as</span> <span class="n">f</span><span class="p">:</span>
    <span class="nb">print</span><span class="p">(</span><span class="n">f</span><span class="o">.</span><span class="n">read</span><span class="p">())</span>

<span class="c1"># Use uber_open_rmode on file path</span>
<span class="k">with</span> <span class="n">am</span><span class="o">.</span><span class="n">tools</span><span class="o">.</span><span class="n">uber_open_rmode</span><span class="p">(</span><span class="n">fname</span><span class="p">)</span> <span class="k">as</span> <span class="n">f</span><span class="p">:</span>
    <span class="nb">print</span><span class="p">(</span><span class="n">f</span><span class="o">.</span><span class="n">read</span><span class="p">())</span>

<span class="c1"># Use uber_open_rmode on file-like object</span>
<span class="k">with</span> <span class="nb">open</span><span class="p">(</span><span class="n">fname</span><span class="p">,</span> <span class="s1">&#39;rb&#39;</span><span class="p">)</span> <span class="k">as</span> <span class="n">fobject</span><span class="p">:</span>
    <span class="k">with</span> <span class="n">am</span><span class="o">.</span><span class="n">tools</span><span class="o">.</span><span class="n">uber_open_rmode</span><span class="p">(</span><span class="n">fobject</span><span class="p">)</span> <span class="k">as</span> <span class="n">f</span><span class="p">:</span>
        <span class="nb">print</span><span class="p">(</span><span class="n">f</span><span class="o">.</span><span class="n">read</span><span class="p">())</span>
</pre></div>
</div>
</div>
<div class="nboutput nblast docutils container">
<div class="prompt empty docutils container">
</div>
<div class="output_area docutils container">
<div class="highlight"><pre>
b&#39;Here I am, read me!&#39;
b&#39;Here I am, read me!&#39;
b&#39;Here I am, read me!&#39;
</pre></div></div>
</div>
</div>
<div class="section" id="5.6.-vect_angle()">
<h3>5.6. vect_angle()<a class="headerlink" href="#5.6.-vect_angle()" title="Permalink to this headline">¶</a></h3>
<p>The vect_angle() function returns the angle between two vectors.</p>
<div class="nbinput docutils container">
<div class="prompt highlight-none notranslate"><div class="highlight"><pre><span></span>[19]:
</pre></div>
</div>
<div class="input_area highlight-ipython3 notranslate"><div class="highlight"><pre>
<span></span><span class="n">vect1</span> <span class="o">=</span> <span class="mi">2</span><span class="o">*</span><span class="n">np</span><span class="o">.</span><span class="n">random</span><span class="o">.</span><span class="n">rand</span><span class="p">(</span><span class="mi">3</span><span class="p">)</span><span class="o">-</span><span class="mi">1</span>
<span class="n">vect2</span> <span class="o">=</span> <span class="mi">2</span><span class="o">*</span><span class="n">np</span><span class="o">.</span><span class="n">random</span><span class="o">.</span><span class="n">rand</span><span class="p">(</span><span class="mi">3</span><span class="p">)</span><span class="o">-</span><span class="mi">1</span>

<span class="nb">print</span><span class="p">(</span><span class="s1">&#39;Angle between&#39;</span><span class="p">,</span> <span class="n">vect1</span><span class="p">,</span> <span class="s1">&#39;and&#39;</span><span class="p">,</span> <span class="n">vect2</span><span class="p">,</span> <span class="s1">&#39;=&#39;</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="n">am</span><span class="o">.</span><span class="n">tools</span><span class="o">.</span><span class="n">vect_angle</span><span class="p">(</span><span class="n">vect1</span><span class="p">,</span> <span class="n">vect2</span><span class="p">),</span> <span class="s1">&#39;degrees&#39;</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="n">am</span><span class="o">.</span><span class="n">tools</span><span class="o">.</span><span class="n">vect_angle</span><span class="p">(</span><span class="n">vect1</span><span class="p">,</span> <span class="n">vect2</span><span class="p">,</span> <span class="s1">&#39;radian&#39;</span><span class="p">),</span> <span class="s1">&#39;radians&#39;</span><span class="p">)</span>
</pre></div>
</div>
</div>
<div class="nboutput nblast docutils container">
<div class="prompt empty docutils container">
</div>
<div class="output_area docutils container">
<div class="highlight"><pre>
Angle between [-0.34828678 -0.74741765  0.60540275] and [-0.67224036  0.72470423 -0.14586779] =
112.78423936770139 degrees
1.9684563213237967 radians
</pre></div></div>
</div>
</div>
<div class="section" id="5.7.-duplicates_allclose()">
<h3>5.7. duplicates_allclose()<a class="headerlink" href="#5.7.-duplicates_allclose()" title="Permalink to this headline">¶</a></h3>
<p>Determine duplicates in dataframe based on tolerances. The implementation first uses pandas.DataFrame.duplicated on the <code class="docutils literal notranslate"><span class="pre">dcols</span></code> argument with <code class="docutils literal notranslate"><span class="pre">keep=False</span></code> to keep all duplicates. The duplicate sub-dataframe is then sorted on both <code class="docutils literal notranslate"><span class="pre">dcols</span></code> and <code class="docutils literal notranslate"><span class="pre">fcols</span></code>. A diff between each row is then done on the sorted duplicates dataframe. The float values are then checked for their tolerances.</p>
<p>Note: False duplicates may be identified if tolerance ranges overlap. Consider dataframe with rows 1,2,3. If row 2 matches row 1 within the tolerances, and row 3 matches row 2 within the tolerances, both rows 2 and 3 will be labeled as tolerances even if row 3 does not match row 1 within the tolerances.</p>
<p>Parameters - <strong>dataframe</strong> (<em>pandas.DataFrame</em>) The dataframe to search for duplicates - <strong>dcols</strong> (<em>list</em>) The column names that are tested for exact duplicates. - <strong>fcols</strong> (<em>dict</em>) The column names (keys) that are tested using absolute tolerances (values).</p>
<p>Returns - (<em>list of bool of length nrows</em>) False for first occurrence of checked values, True for subsequent duplicates.</p>
<div class="nbinput docutils container">
<div class="prompt highlight-none notranslate"><div class="highlight"><pre><span></span>[20]:
</pre></div>
</div>
<div class="input_area highlight-ipython3 notranslate"><div class="highlight"><pre>
<span></span><span class="c1"># Generate test DataFrame</span>
<span class="n">df</span> <span class="o">=</span> <span class="n">pd</span><span class="o">.</span><span class="n">DataFrame</span><span class="p">({</span><span class="s1">&#39;A&#39;</span><span class="p">:[</span><span class="mf">1.00001</span><span class="p">,</span> <span class="mf">1.00002</span><span class="p">,</span> <span class="mf">3.0000</span><span class="p">,</span> <span class="mf">1.000000</span><span class="p">],</span> <span class="s1">&#39;B&#39;</span><span class="p">:[</span><span class="s1">&#39;Same&#39;</span><span class="p">,</span> <span class="s1">&#39;Diff&#39;</span><span class="p">,</span> <span class="s1">&#39;Same&#39;</span><span class="p">,</span> <span class="s1">&#39;Same&#39;</span><span class="p">]})</span>
<span class="n">df</span>
</pre></div>
</div>
</div>
<div class="nboutput nblast docutils container">
<div class="prompt highlight-none notranslate"><div class="highlight"><pre><span></span>[20]:
</pre></div>
</div>
<div class="output_area rendered_html docutils container">
<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

    .dataframe tbody tr th {
        vertical-align: top;
    }

    .dataframe thead th {
        text-align: right;
    }
</style>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>A</th>
      <th>B</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>0</td>
      <td>1.00001</td>
      <td>Same</td>
    </tr>
    <tr>
      <td>1</td>
      <td>1.00002</td>
      <td>Diff</td>
    </tr>
    <tr>
      <td>2</td>
      <td>3.00000</td>
      <td>Same</td>
    </tr>
    <tr>
      <td>3</td>
      <td>1.00000</td>
      <td>Same</td>
    </tr>
  </tbody>
</table>
</div></div>
</div>
<div class="nbinput docutils container">
<div class="prompt highlight-none notranslate"><div class="highlight"><pre><span></span>[21]:
</pre></div>
</div>
<div class="input_area highlight-ipython3 notranslate"><div class="highlight"><pre>
<span></span><span class="c1"># Show unique values</span>
<span class="n">df</span><span class="p">[</span><span class="o">~</span><span class="n">am</span><span class="o">.</span><span class="n">tools</span><span class="o">.</span><span class="n">duplicates_allclose</span><span class="p">(</span><span class="n">df</span><span class="p">,</span> <span class="n">dcols</span><span class="o">=</span><span class="p">[</span><span class="s1">&#39;B&#39;</span><span class="p">],</span> <span class="n">fcols</span><span class="o">=</span><span class="p">{</span><span class="s1">&#39;A&#39;</span><span class="p">:</span><span class="mf">1e-4</span><span class="p">})]</span>
</pre></div>
</div>
</div>
<div class="nboutput nblast docutils container">
<div class="prompt highlight-none notranslate"><div class="highlight"><pre><span></span>[21]:
</pre></div>
</div>
<div class="output_area rendered_html docutils container">
<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

    .dataframe tbody tr th {
        vertical-align: top;
    }

    .dataframe thead th {
        text-align: right;
    }
</style>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>A</th>
      <th>B</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>1</td>
      <td>1.00002</td>
      <td>Diff</td>
    </tr>
    <tr>
      <td>2</td>
      <td>3.00000</td>
      <td>Same</td>
    </tr>
    <tr>
      <td>3</td>
      <td>1.00000</td>
      <td>Same</td>
    </tr>
  </tbody>
</table>
</div></div>
</div>
</div>
<div class="section" id="5.8.-Miller-index-conversions">
<h3>5.8. Miller index conversions<a class="headerlink" href="#5.8.-Miller-index-conversions" title="Permalink to this headline">¶</a></h3>
<ul class="simple">
<li><p><strong>atomman.tools.miller.vector3to4(indices)</strong> converts vectors from three-term Miller indices to four-term Miller-Bravais indices for hexagonal systems. <em>Updated version 1.2.6</em>: now returns vectors with magnitudes consistent withe given vectors rather than rescaling to the smallest integer representations.</p></li>
<li><p><strong>atomman.tools.miller.vector4to3(indices)</strong> converts vectors from four-term Miller-Bravais indices to three-term Miller indices. <em>Updated version 1.2.6</em>: now returns vectors with magnitudes consistent withe given vectors rather than rescaling to the smallest integer representations.</p></li>
<li><p><strong>atomman.tools.miller.plane3to4(indices)</strong> converts planes from three-term Miller indices to four-term Miller-Bravais indices for hexagonal systems. <em>Added version 1.2.8</em></p></li>
<li><p><strong>atomman.tools.miller.plane4to3(indices)</strong> converts planes from four-term Miller-Bravais indices to three-term Miller indices. <em>Added version 1.2.8</em></p></li>
<li><p><strong>atomman.tools.miller.vector_crystal_to_cartesian(indices, box)</strong> converts Miller and Miller-Bravais indices to Cartesian vectors based on a supplied box. <em>Updated version 1.2.6</em> renamed from vectortocartesian for consistency.</p></li>
<li><p><strong>atomman.tools.miller.plane_crystal_to_cartesian(indices, box)</strong> converts Miller and Miller-Bravais plane indices to Cartesian normal vectors based on a supplied box. The method uses the definition of the crystal planes to identify two in-plane crystal vectors, converts them to Cartesian, and obtains the plane normal as the cross product of the two vectors. <em>Added version 1.3.2</em></p></li>
<li><p><strong>atomman.tools.miller.vector_primitive_to_conventional(indices, setting)</strong> converts vectors relative to a primitive unit cell to a conventional unit cell in the given setting (p, a, b, c, i or f). <em>Added version 1.2.6</em></p></li>
<li><p><strong>atomman.tools.miller.vector_conventional_to_primitive(indices, setting)</strong> converts vectors relative to a conventional unit cell in the given setting (p, a, b, c, i or f) to a primitive unit cell. <em>Added version 1.2.6</em></p></li>
</ul>
<div class="nbinput docutils container">
<div class="prompt highlight-none notranslate"><div class="highlight"><pre><span></span>[22]:
</pre></div>
</div>
<div class="input_area highlight-ipython3 notranslate"><div class="highlight"><pre>
<span></span><span class="c1"># Test single vector conversions</span>
<span class="nb">print</span><span class="p">(</span><span class="n">am</span><span class="o">.</span><span class="n">tools</span><span class="o">.</span><span class="n">miller</span><span class="o">.</span><span class="n">vector3to4</span><span class="p">(</span><span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">([</span><span class="mi">3</span><span class="p">,</span><span class="mi">3</span><span class="p">,</span><span class="mi">3</span><span class="p">])))</span>
<span class="nb">print</span><span class="p">(</span><span class="n">am</span><span class="o">.</span><span class="n">tools</span><span class="o">.</span><span class="n">miller</span><span class="o">.</span><span class="n">vector4to3</span><span class="p">(</span><span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">([</span><span class="mi">1</span><span class="p">,</span><span class="mi">1</span><span class="p">,</span><span class="o">-</span><span class="mi">2</span><span class="p">,</span><span class="mi">0</span><span class="p">])))</span>
</pre></div>
</div>
</div>
<div class="nboutput nblast docutils container">
<div class="prompt empty docutils container">
</div>
<div class="output_area docutils container">
<div class="highlight"><pre>
[ 1.  1. -2.  3.]
[3. 3. 0.]
</pre></div></div>
</div>
<div class="nbinput docutils container">
<div class="prompt highlight-none notranslate"><div class="highlight"><pre><span></span>[23]:
</pre></div>
</div>
<div class="input_area highlight-ipython3 notranslate"><div class="highlight"><pre>
<span></span><span class="c1"># Generate random uvw crystal indices</span>
<span class="n">indices</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">random</span><span class="o">.</span><span class="n">randint</span><span class="p">(</span><span class="o">-</span><span class="mi">5</span><span class="p">,</span><span class="mi">6</span><span class="p">,</span> <span class="p">(</span><span class="mi">3</span><span class="p">,</span><span class="mi">3</span><span class="p">))</span>
<span class="nb">print</span><span class="p">(</span><span class="n">indices</span><span class="p">)</span>
<span class="nb">print</span><span class="p">()</span>

<span class="c1"># Convert to hexagonal uvtw&#39;s</span>
<span class="n">indices</span> <span class="o">=</span> <span class="n">am</span><span class="o">.</span><span class="n">tools</span><span class="o">.</span><span class="n">miller</span><span class="o">.</span><span class="n">vector3to4</span><span class="p">(</span><span class="n">indices</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="n">indices</span><span class="p">)</span>
<span class="nb">print</span><span class="p">()</span>

<span class="c1"># Convert back to uvw&#39;s and see that values are recovered</span>
<span class="n">indices</span> <span class="o">=</span> <span class="n">am</span><span class="o">.</span><span class="n">tools</span><span class="o">.</span><span class="n">miller</span><span class="o">.</span><span class="n">vector4to3</span><span class="p">(</span><span class="n">indices</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="n">indices</span><span class="p">)</span>
</pre></div>
</div>
</div>
<div class="nboutput nblast docutils container">
<div class="prompt empty docutils container">
</div>
<div class="output_area docutils container">
<div class="highlight"><pre>
[[-1  0  2]
 [ 3 -4  4]
 [ 1 -2  1]]

[[-0.66666667  0.33333333  0.33333333  2.        ]
 [ 3.33333333 -3.66666667  0.33333333  4.        ]
 [ 1.33333333 -1.66666667  0.33333333  1.        ]]

[[-1.  0.  2.]
 [ 3. -4.  4.]
 [ 1. -2.  1.]]
</pre></div></div>
</div>
<div class="nbinput docutils container">
<div class="prompt highlight-none notranslate"><div class="highlight"><pre><span></span>[24]:
</pre></div>
</div>
<div class="input_area highlight-ipython3 notranslate"><div class="highlight"><pre>
<span></span><span class="c1"># Test single plane conversions</span>
<span class="nb">print</span><span class="p">(</span><span class="n">am</span><span class="o">.</span><span class="n">tools</span><span class="o">.</span><span class="n">miller</span><span class="o">.</span><span class="n">plane3to4</span><span class="p">(</span><span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">([</span><span class="mi">3</span><span class="p">,</span><span class="mi">3</span><span class="p">,</span><span class="mi">3</span><span class="p">])))</span>
<span class="nb">print</span><span class="p">(</span><span class="n">am</span><span class="o">.</span><span class="n">tools</span><span class="o">.</span><span class="n">miller</span><span class="o">.</span><span class="n">plane4to3</span><span class="p">(</span><span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">([</span><span class="mi">1</span><span class="p">,</span><span class="mi">1</span><span class="p">,</span><span class="o">-</span><span class="mi">2</span><span class="p">,</span><span class="mi">0</span><span class="p">])))</span>
</pre></div>
</div>
</div>
<div class="nboutput nblast docutils container">
<div class="prompt empty docutils container">
</div>
<div class="output_area docutils container">
<div class="highlight"><pre>
[ 3.  3. -6.  3.]
[1. 1. 0.]
</pre></div></div>
</div>
<div class="nbinput docutils container">
<div class="prompt highlight-none notranslate"><div class="highlight"><pre><span></span>[25]:
</pre></div>
</div>
<div class="input_area highlight-ipython3 notranslate"><div class="highlight"><pre>
<span></span><span class="c1"># Generate random hkl crystal indices</span>
<span class="n">indices</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">random</span><span class="o">.</span><span class="n">randint</span><span class="p">(</span><span class="o">-</span><span class="mi">5</span><span class="p">,</span><span class="mi">6</span><span class="p">,</span> <span class="p">(</span><span class="mi">3</span><span class="p">,</span><span class="mi">3</span><span class="p">))</span>
<span class="nb">print</span><span class="p">(</span><span class="n">indices</span><span class="p">)</span>
<span class="nb">print</span><span class="p">()</span>

<span class="c1"># Convert to hexagonal hkil&#39;s</span>
<span class="n">indices</span> <span class="o">=</span> <span class="n">am</span><span class="o">.</span><span class="n">tools</span><span class="o">.</span><span class="n">miller</span><span class="o">.</span><span class="n">plane3to4</span><span class="p">(</span><span class="n">indices</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="n">indices</span><span class="p">)</span>
<span class="nb">print</span><span class="p">()</span>

<span class="c1"># Convert back to hkl&#39;s and see that values are recovered</span>
<span class="n">indices</span> <span class="o">=</span> <span class="n">am</span><span class="o">.</span><span class="n">tools</span><span class="o">.</span><span class="n">miller</span><span class="o">.</span><span class="n">plane4to3</span><span class="p">(</span><span class="n">indices</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="n">indices</span><span class="p">)</span>
</pre></div>
</div>
</div>
<div class="nboutput nblast docutils container">
<div class="prompt empty docutils container">
</div>
<div class="output_area docutils container">
<div class="highlight"><pre>
[[-2  4  0]
 [-1 -3  5]
 [ 3  3 -5]]

[[-2.  4. -2.  0.]
 [-1. -3.  4.  5.]
 [ 3.  3. -6. -5.]]

[[-2.  4.  0.]
 [-1. -3.  5.]
 [ 3.  3. -5.]]
</pre></div></div>
</div>
<div class="nbinput docutils container">
<div class="prompt highlight-none notranslate"><div class="highlight"><pre><span></span>[26]:
</pre></div>
</div>
<div class="input_area highlight-ipython3 notranslate"><div class="highlight"><pre>
<span></span><span class="c1"># Define a hexagonal box</span>
<span class="n">a</span> <span class="o">=</span> <span class="n">uc</span><span class="o">.</span><span class="n">set_in_units</span><span class="p">(</span><span class="mf">2.51</span><span class="p">,</span> <span class="s1">&#39;angstrom&#39;</span><span class="p">)</span>
<span class="n">c</span> <span class="o">=</span> <span class="n">uc</span><span class="o">.</span><span class="n">set_in_units</span><span class="p">(</span><span class="mf">4.07</span><span class="p">,</span> <span class="s1">&#39;angstrom&#39;</span><span class="p">)</span>
<span class="n">box</span> <span class="o">=</span> <span class="n">am</span><span class="o">.</span><span class="n">Box</span><span class="p">(</span><span class="n">a</span><span class="o">=</span><span class="n">a</span><span class="p">,</span> <span class="n">b</span><span class="o">=</span><span class="n">a</span><span class="p">,</span> <span class="n">c</span><span class="o">=</span><span class="n">c</span><span class="p">,</span> <span class="n">gamma</span><span class="o">=</span><span class="mi">120</span><span class="p">)</span>

<span class="c1"># Pass Miller indices</span>
<span class="n">indices</span> <span class="o">=</span> <span class="p">[[</span><span class="mi">1</span><span class="p">,</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">],</span>
           <span class="p">[</span><span class="mi">0</span><span class="p">,</span><span class="mi">1</span><span class="p">,</span><span class="mi">0</span><span class="p">],</span>
           <span class="p">[</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">,</span><span class="mi">1</span><span class="p">]]</span>
<span class="nb">print</span><span class="p">(</span><span class="n">am</span><span class="o">.</span><span class="n">tools</span><span class="o">.</span><span class="n">miller</span><span class="o">.</span><span class="n">vector_crystal_to_cartesian</span><span class="p">(</span><span class="n">indices</span><span class="p">,</span> <span class="n">box</span><span class="p">))</span>
<span class="nb">print</span><span class="p">()</span>

<span class="c1"># Pass equivalent Miller-Bravais indices</span>
<span class="n">indices</span> <span class="o">=</span> <span class="p">[[</span> <span class="mi">2</span><span class="o">/</span><span class="mi">3</span><span class="p">,</span><span class="o">-</span><span class="mi">1</span><span class="o">/</span><span class="mi">3</span><span class="p">,</span><span class="o">-</span><span class="mi">1</span><span class="o">/</span><span class="mi">3</span><span class="p">,</span> <span class="mi">0</span><span class="p">],</span>
           <span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="o">/</span><span class="mi">3</span><span class="p">,</span> <span class="mi">2</span><span class="o">/</span><span class="mi">3</span><span class="p">,</span><span class="o">-</span><span class="mi">1</span><span class="o">/</span><span class="mi">3</span><span class="p">,</span> <span class="mi">0</span><span class="p">],</span>
           <span class="p">[</span>   <span class="mi">0</span><span class="p">,</span>   <span class="mi">0</span><span class="p">,</span>   <span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">]]</span>
<span class="nb">print</span><span class="p">(</span><span class="n">am</span><span class="o">.</span><span class="n">tools</span><span class="o">.</span><span class="n">miller</span><span class="o">.</span><span class="n">vector_crystal_to_cartesian</span><span class="p">(</span><span class="n">indices</span><span class="p">,</span> <span class="n">box</span><span class="p">))</span>
</pre></div>
</div>
</div>
<div class="nboutput nblast docutils container">
<div class="prompt empty docutils container">
</div>
<div class="output_area docutils container">
<div class="highlight"><pre>
[[ 2.51        0.          0.        ]
 [-1.255       2.17372376  0.        ]
 [ 0.          0.          4.07      ]]

[[ 2.51        0.          0.        ]
 [-1.255       2.17372376  0.        ]
 [ 0.          0.          4.07      ]]
</pre></div></div>
</div>
<div class="nbinput docutils container">
<div class="prompt highlight-none notranslate"><div class="highlight"><pre><span></span>[27]:
</pre></div>
</div>
<div class="input_area highlight-ipython3 notranslate"><div class="highlight"><pre>
<span></span><span class="c1"># Define a hexagonal box</span>
<span class="n">a</span> <span class="o">=</span> <span class="n">uc</span><span class="o">.</span><span class="n">set_in_units</span><span class="p">(</span><span class="mf">2.51</span><span class="p">,</span> <span class="s1">&#39;angstrom&#39;</span><span class="p">)</span>
<span class="n">c</span> <span class="o">=</span> <span class="n">uc</span><span class="o">.</span><span class="n">set_in_units</span><span class="p">(</span><span class="mf">4.07</span><span class="p">,</span> <span class="s1">&#39;angstrom&#39;</span><span class="p">)</span>
<span class="n">box</span> <span class="o">=</span> <span class="n">am</span><span class="o">.</span><span class="n">Box</span><span class="p">(</span><span class="n">a</span><span class="o">=</span><span class="n">a</span><span class="p">,</span> <span class="n">b</span><span class="o">=</span><span class="n">a</span><span class="p">,</span> <span class="n">c</span><span class="o">=</span><span class="n">c</span><span class="p">,</span> <span class="n">gamma</span><span class="o">=</span><span class="mi">120</span><span class="p">)</span>

<span class="c1"># Pass Miller plane indices</span>
<span class="n">indices</span> <span class="o">=</span> <span class="p">[</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">]</span>
<span class="nb">print</span><span class="p">(</span><span class="n">am</span><span class="o">.</span><span class="n">tools</span><span class="o">.</span><span class="n">miller</span><span class="o">.</span><span class="n">plane_crystal_to_cartesian</span><span class="p">(</span><span class="n">indices</span><span class="p">,</span> <span class="n">box</span><span class="p">))</span>
<span class="n">indices</span> <span class="o">=</span> <span class="p">[</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">]</span>
<span class="nb">print</span><span class="p">(</span><span class="n">am</span><span class="o">.</span><span class="n">tools</span><span class="o">.</span><span class="n">miller</span><span class="o">.</span><span class="n">plane_crystal_to_cartesian</span><span class="p">(</span><span class="n">indices</span><span class="p">,</span> <span class="n">box</span><span class="p">))</span>
<span class="nb">print</span><span class="p">()</span>

<span class="c1"># Pass equivalent Miller-Bravais indices</span>
<span class="n">indices</span> <span class="o">=</span> <span class="p">[</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">]</span>
<span class="nb">print</span><span class="p">(</span><span class="n">am</span><span class="o">.</span><span class="n">tools</span><span class="o">.</span><span class="n">miller</span><span class="o">.</span><span class="n">plane_crystal_to_cartesian</span><span class="p">(</span><span class="n">indices</span><span class="p">,</span> <span class="n">box</span><span class="p">))</span>
<span class="n">indices</span> <span class="o">=</span> <span class="p">[</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span><span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="mi">0</span><span class="p">]</span>
<span class="nb">print</span><span class="p">(</span><span class="n">am</span><span class="o">.</span><span class="n">tools</span><span class="o">.</span><span class="n">miller</span><span class="o">.</span><span class="n">plane_crystal_to_cartesian</span><span class="p">(</span><span class="n">indices</span><span class="p">,</span> <span class="n">box</span><span class="p">))</span>
</pre></div>
</div>
</div>
<div class="nboutput nblast docutils container">
<div class="prompt empty docutils container">
</div>
<div class="output_area docutils container">
<div class="highlight"><pre>
[ 0. -0.  1.]
[ 0.8660254  0.5       -0.       ]

[ 0. -0.  1.]
[ 0.8660254  0.5       -0.       ]
</pre></div></div>
</div>
<div class="nbinput docutils container">
<div class="prompt highlight-none notranslate"><div class="highlight"><pre><span></span>[28]:
</pre></div>
</div>
<div class="input_area highlight-ipython3 notranslate"><div class="highlight"><pre>
<span></span><span class="c1"># Define a primitive bcc unit cell box</span>
<span class="n">a</span> <span class="o">=</span> <span class="n">uc</span><span class="o">.</span><span class="n">set_in_units</span><span class="p">(</span><span class="mf">2.86</span><span class="p">,</span> <span class="s1">&#39;angstrom&#39;</span><span class="p">)</span>
<span class="n">p_box</span> <span class="o">=</span> <span class="n">am</span><span class="o">.</span><span class="n">Box</span><span class="o">.</span><span class="n">trigonal</span><span class="p">(</span><span class="n">a</span> <span class="o">*</span> <span class="mi">3</span><span class="o">**</span><span class="mf">0.5</span> <span class="o">/</span> <span class="mi">2</span><span class="p">,</span> <span class="n">alpha</span><span class="o">=</span><span class="mf">109.466666667</span><span class="p">)</span>
<span class="n">p_ucell</span> <span class="o">=</span> <span class="n">am</span><span class="o">.</span><span class="n">System</span><span class="p">(</span><span class="n">box</span><span class="o">=</span><span class="n">p_box</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="n">p_ucell</span><span class="p">)</span>
</pre></div>
</div>
</div>
<div class="nboutput nblast docutils container">
<div class="prompt empty docutils container">
</div>
<div class="output_area docutils container">
<div class="highlight"><pre>
avect =  [ 2.477,  0.000,  0.000]
bvect =  [-0.825,  2.335,  0.000]
cvect =  [-0.825, -1.167,  2.023]
origin = [ 0.000,  0.000,  0.000]
natoms = 1
natypes = 1
symbols = (None,)
pbc = [ True  True  True]
per-atom properties = [&#39;atype&#39;, &#39;pos&#39;]
     id |   atype |  pos[0] |  pos[1] |  pos[2]
      0 |       1 |   0.000 |   0.000 |   0.000
</pre></div></div>
</div>
<div class="nbinput docutils container">
<div class="prompt highlight-none notranslate"><div class="highlight"><pre><span></span>[29]:
</pre></div>
</div>
<div class="input_area highlight-ipython3 notranslate"><div class="highlight"><pre>
<span></span><span class="c1"># Convert conventional box vectors to primitive vectors</span>
<span class="n">a_uvw</span> <span class="o">=</span> <span class="n">am</span><span class="o">.</span><span class="n">tools</span><span class="o">.</span><span class="n">miller</span><span class="o">.</span><span class="n">vector_conventional_to_primitive</span><span class="p">([</span><span class="mi">1</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">],</span> <span class="n">setting</span><span class="o">=</span><span class="s1">&#39;i&#39;</span><span class="p">)</span>
<span class="n">b_uvw</span> <span class="o">=</span> <span class="n">am</span><span class="o">.</span><span class="n">tools</span><span class="o">.</span><span class="n">miller</span><span class="o">.</span><span class="n">vector_conventional_to_primitive</span><span class="p">([</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">0</span><span class="p">],</span> <span class="n">setting</span><span class="o">=</span><span class="s1">&#39;i&#39;</span><span class="p">)</span>
<span class="n">c_uvw</span> <span class="o">=</span> <span class="n">am</span><span class="o">.</span><span class="n">tools</span><span class="o">.</span><span class="n">miller</span><span class="o">.</span><span class="n">vector_conventional_to_primitive</span><span class="p">([</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">],</span> <span class="n">setting</span><span class="o">=</span><span class="s1">&#39;i&#39;</span><span class="p">)</span>
<span class="n">p_uvws</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">([</span><span class="n">a_uvw</span><span class="p">,</span> <span class="n">b_uvw</span><span class="p">,</span> <span class="n">c_uvw</span><span class="p">])</span>
<span class="nb">print</span><span class="p">(</span><span class="s1">&#39;primitive uvws:&#39;</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="n">p_uvws</span><span class="p">)</span>

<span class="c1"># Convert back to conventional just for consistency</span>
<span class="nb">print</span><span class="p">(</span><span class="s1">&#39;conventional uvws:&#39;</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="n">am</span><span class="o">.</span><span class="n">tools</span><span class="o">.</span><span class="n">miller</span><span class="o">.</span><span class="n">vector_primitive_to_conventional</span><span class="p">(</span><span class="n">p_uvws</span><span class="p">,</span> <span class="n">setting</span><span class="o">=</span><span class="s1">&#39;i&#39;</span><span class="p">))</span>
</pre></div>
</div>
</div>
<div class="nboutput nblast docutils container">
<div class="prompt empty docutils container">
</div>
<div class="output_area docutils container">
<div class="highlight"><pre>
primitive uvws:
[[ 0. -1. -1.]
 [ 1.  1.  0.]
 [ 1.  0.  1.]]
conventional uvws:
[[1. 0. 0.]
 [0. 1. 0.]
 [0. 0. 1.]]
</pre></div></div>
</div>
<div class="nbinput docutils container">
<div class="prompt highlight-none notranslate"><div class="highlight"><pre><span></span>[30]:
</pre></div>
</div>
<div class="input_area highlight-ipython3 notranslate"><div class="highlight"><pre>
<span></span><span class="c1"># rotate system using p_uvws to get conventional unit cell</span>
<span class="n">c_ucell</span> <span class="o">=</span> <span class="n">p_ucell</span><span class="o">.</span><span class="n">rotate</span><span class="p">(</span><span class="n">p_uvws</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="n">c_ucell</span><span class="p">)</span>
</pre></div>
</div>
</div>
<div class="nboutput nblast docutils container">
<div class="prompt empty docutils container">
</div>
<div class="output_area docutils container">
<div class="highlight"><pre>
avect =  [ 2.860,  0.000,  0.000]
bvect =  [-0.000,  2.860,  0.000]
cvect =  [-0.000,  0.000,  2.860]
origin = [ 0.000,  0.000,  0.000]
natoms = 2
natypes = 1
symbols = (None,)
pbc = [ True  True  True]
per-atom properties = [&#39;atype&#39;, &#39;pos&#39;]
     id |   atype |  pos[0] |  pos[1] |  pos[2]
      0 |       1 |   0.000 |   0.000 |   0.000
      1 |       1 |   1.430 |   1.430 |   1.430
</pre></div></div>
</div>
</div>
<div class="section" id="5.9.-Crystal-lattice-identification">
<h3>5.9. Crystal lattice identification<a class="headerlink" href="#5.9.-Crystal-lattice-identification" title="Permalink to this headline">¶</a></h3>
<p>There are also a few tests for identifying if a supplied box is consistent with a standard representation of a crystal family unit cell.</p>
<ul class="simple">
<li><p><strong>atomman.tools.identifyfamily(box)</strong> returns str crystal family if box corresponds to a standard crystal representation. Otherwise, returns None.</p></li>
<li><p><strong>atomman.tools.iscubic(box))</strong> returns bool indicating if box is a standard cubic box.</p></li>
<li><p><strong>atomman.tools.ishexagonal(box))</strong> returns bool indicating if box is a standard hexagonal box.</p></li>
<li><p><strong>atomman.tools.istetragonal(box))</strong> returns bool indicating if box is a standard tetragonal box.</p></li>
<li><p><strong>atomman.tools.isrhombohedral(box))</strong> returns bool indicating if box is a standard rhombohedral box.</p></li>
<li><p><strong>atomman.tools.isorthorhombic(box))</strong> returns bool indicating if box is a standard orthorhombic box.</p></li>
<li><p><strong>atomman.tools.ismonoclinic(box))</strong> returns bool indicating if box is a standard monoclinic box.</p></li>
<li><p><strong>atomman.tools.istriclinic(box))</strong> returns bool indicating if box is a standard triclinic box.</p></li>
</ul>
<p>All of these functions use the following standard representation criteria:</p>
<ul class="simple">
<li><p>cubic:</p>
<ul>
<li><p><span class="math notranslate nohighlight">\(a = b = c\)</span></p></li>
<li><p><span class="math notranslate nohighlight">\(\alpha = \beta = \gamma = 90\)</span></p></li>
</ul>
</li>
<li><p>hexagonal:</p>
<ul>
<li><p><span class="math notranslate nohighlight">\(a = b \ne c\)</span></p></li>
<li><p><span class="math notranslate nohighlight">\(\alpha = \beta = 90\)</span></p></li>
<li><p><span class="math notranslate nohighlight">\(\gamma = 120\)</span></p></li>
</ul>
</li>
<li><p>tetragonal:</p>
<ul>
<li><p><span class="math notranslate nohighlight">\(a = b \ne c\)</span></p></li>
<li><p><span class="math notranslate nohighlight">\(\alpha = \beta = \gamma = 90\)</span></p></li>
</ul>
</li>
<li><p>rhombohedral:</p>
<ul>
<li><p><span class="math notranslate nohighlight">\(a = b = c\)</span></p></li>
<li><p><span class="math notranslate nohighlight">\(\alpha = \beta = \gamma \ne 90\)</span></p></li>
</ul>
</li>
<li><p>orthorhombic:</p>
<ul>
<li><p><span class="math notranslate nohighlight">\(a \ne b \ne c\)</span></p></li>
<li><p><span class="math notranslate nohighlight">\(\alpha = \beta = \gamma = 90\)</span></p></li>
</ul>
</li>
<li><p>monoclinic:</p>
<ul>
<li><p><span class="math notranslate nohighlight">\(a \ne b \ne c\)</span></p></li>
<li><p><span class="math notranslate nohighlight">\(\alpha = \gamma = 90\)</span></p></li>
<li><p><span class="math notranslate nohighlight">\(\beta \ne 90\)</span></p></li>
</ul>
</li>
<li><p>triclinic:</p>
<ul>
<li><p><span class="math notranslate nohighlight">\(a \ne b \ne c\)</span></p></li>
<li><p><span class="math notranslate nohighlight">\(\alpha \ne \beta \ne \gamma\)</span></p></li>
</ul>
</li>
</ul>
<div class="nbinput docutils container">
<div class="prompt highlight-none notranslate"><div class="highlight"><pre><span></span>[31]:
</pre></div>
</div>
<div class="input_area highlight-ipython3 notranslate"><div class="highlight"><pre>
<span></span><span class="c1"># Define an orthogonal box</span>
<span class="n">a</span> <span class="o">=</span> <span class="n">uc</span><span class="o">.</span><span class="n">set_in_units</span><span class="p">(</span><span class="mf">2.51</span><span class="p">,</span> <span class="s1">&#39;angstrom&#39;</span><span class="p">)</span>
<span class="n">b</span> <span class="o">=</span> <span class="n">uc</span><span class="o">.</span><span class="n">set_in_units</span><span class="p">(</span><span class="mf">3.13</span><span class="p">,</span> <span class="s1">&#39;angstrom&#39;</span><span class="p">)</span>
<span class="n">c</span> <span class="o">=</span> <span class="n">uc</span><span class="o">.</span><span class="n">set_in_units</span><span class="p">(</span><span class="mf">4.07</span><span class="p">,</span> <span class="s1">&#39;angstrom&#39;</span><span class="p">)</span>
<span class="n">box</span> <span class="o">=</span> <span class="n">am</span><span class="o">.</span><span class="n">Box</span><span class="p">(</span><span class="n">a</span><span class="o">=</span><span class="n">a</span><span class="p">,</span> <span class="n">b</span><span class="o">=</span><span class="n">b</span><span class="p">,</span> <span class="n">c</span><span class="o">=</span><span class="n">c</span><span class="p">)</span>

<span class="nb">print</span><span class="p">(</span><span class="s1">&#39;identifyfamily =&#39;</span><span class="p">,</span> <span class="n">am</span><span class="o">.</span><span class="n">tools</span><span class="o">.</span><span class="n">identifyfamily</span><span class="p">(</span><span class="n">box</span><span class="p">))</span>
<span class="nb">print</span><span class="p">(</span><span class="s1">&#39;iscubic =       &#39;</span><span class="p">,</span> <span class="n">am</span><span class="o">.</span><span class="n">tools</span><span class="o">.</span><span class="n">iscubic</span><span class="p">(</span><span class="n">box</span><span class="p">))</span>
<span class="nb">print</span><span class="p">(</span><span class="s1">&#39;ishexagonal =   &#39;</span><span class="p">,</span> <span class="n">am</span><span class="o">.</span><span class="n">tools</span><span class="o">.</span><span class="n">ishexagonal</span><span class="p">(</span><span class="n">box</span><span class="p">))</span>
<span class="nb">print</span><span class="p">(</span><span class="s1">&#39;istetragonal =  &#39;</span><span class="p">,</span> <span class="n">am</span><span class="o">.</span><span class="n">tools</span><span class="o">.</span><span class="n">istetragonal</span><span class="p">(</span><span class="n">box</span><span class="p">))</span>
<span class="nb">print</span><span class="p">(</span><span class="s1">&#39;isrhombohedral =&#39;</span><span class="p">,</span> <span class="n">am</span><span class="o">.</span><span class="n">tools</span><span class="o">.</span><span class="n">isrhombohedral</span><span class="p">(</span><span class="n">box</span><span class="p">))</span>
<span class="nb">print</span><span class="p">(</span><span class="s1">&#39;isorthorhombic =&#39;</span><span class="p">,</span> <span class="n">am</span><span class="o">.</span><span class="n">tools</span><span class="o">.</span><span class="n">isorthorhombic</span><span class="p">(</span><span class="n">box</span><span class="p">))</span>
<span class="nb">print</span><span class="p">(</span><span class="s1">&#39;ismonoclinic =  &#39;</span><span class="p">,</span> <span class="n">am</span><span class="o">.</span><span class="n">tools</span><span class="o">.</span><span class="n">ismonoclinic</span><span class="p">(</span><span class="n">box</span><span class="p">))</span>
<span class="nb">print</span><span class="p">(</span><span class="s1">&#39;istriclinic =   &#39;</span><span class="p">,</span> <span class="n">am</span><span class="o">.</span><span class="n">tools</span><span class="o">.</span><span class="n">istriclinic</span><span class="p">(</span><span class="n">box</span><span class="p">))</span>
</pre></div>
</div>
</div>
<div class="nboutput nblast docutils container">
<div class="prompt empty docutils container">
</div>
<div class="output_area docutils container">
<div class="highlight"><pre>
identifyfamily = orthorhombic
iscubic =        False
ishexagonal =    False
istetragonal =   False
isrhombohedral = False
isorthorhombic = True
ismonoclinic =   False
istriclinic =    False
</pre></div></div>
</div>
<div class="nbinput docutils container">
<div class="prompt highlight-none notranslate"><div class="highlight"><pre><span></span>[32]:
</pre></div>
</div>
<div class="input_area highlight-ipython3 notranslate"><div class="highlight"><pre>
<span></span><span class="c1"># Define a non-standard tetragonal box with a=c!=b</span>
<span class="n">box</span> <span class="o">=</span> <span class="n">am</span><span class="o">.</span><span class="n">Box</span><span class="p">(</span><span class="n">a</span><span class="o">=</span><span class="n">a</span><span class="p">,</span> <span class="n">b</span><span class="o">=</span><span class="n">b</span><span class="p">,</span> <span class="n">c</span><span class="o">=</span><span class="n">a</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="s1">&#39;identifyfamily =&#39;</span><span class="p">,</span> <span class="n">am</span><span class="o">.</span><span class="n">tools</span><span class="o">.</span><span class="n">identifyfamily</span><span class="p">(</span><span class="n">box</span><span class="p">))</span>
</pre></div>
</div>
</div>
<div class="nboutput nblast docutils container">
<div class="prompt empty docutils container">
</div>
<div class="output_area docutils container">
<div class="highlight"><pre>
identifyfamily = None
</pre></div></div>
</div>
</div>
<div class="section" id="5.10.-compositionstr()">
<h3>5.10. compositionstr()<a class="headerlink" href="#5.10.-compositionstr()" title="Permalink to this headline">¶</a></h3>
<p><em>Added version 1.2.7</em></p>
<p>Takes a list of symbols and the counts for each and returns a reduced composition string. Used by System.composition.</p>
<div class="nbinput docutils container">
<div class="prompt highlight-none notranslate"><div class="highlight"><pre><span></span>[33]:
</pre></div>
</div>
<div class="input_area highlight-ipython3 notranslate"><div class="highlight"><pre>
<span></span><span class="n">symbols</span> <span class="o">=</span> <span class="p">[</span><span class="s1">&#39;Si&#39;</span><span class="p">,</span> <span class="s1">&#39;Al&#39;</span><span class="p">,</span> <span class="s1">&#39;Si&#39;</span><span class="p">]</span>
<span class="n">counts</span> <span class="o">=</span> <span class="p">[</span><span class="mi">500</span><span class="p">,</span> <span class="mi">1000</span><span class="p">,</span> <span class="mi">2000</span><span class="p">]</span>
<span class="nb">print</span><span class="p">(</span><span class="s1">&#39;Composition =&#39;</span><span class="p">,</span> <span class="n">am</span><span class="o">.</span><span class="n">tools</span><span class="o">.</span><span class="n">compositionstr</span><span class="p">(</span><span class="n">symbols</span><span class="p">,</span> <span class="n">counts</span><span class="p">))</span>
</pre></div>
</div>
</div>
<div class="nboutput nblast docutils container">
<div class="prompt empty docutils container">
</div>
<div class="output_area docutils container">
<div class="highlight"><pre>
Composition = Al2Si5
</pre></div></div>
</div>
<p><strong>File Cleanup</strong></p>
<div class="nbinput nblast docutils container">
<div class="prompt highlight-none notranslate"><div class="highlight"><pre><span></span>[34]:
</pre></div>
</div>
<div class="input_area highlight-ipython3 notranslate"><div class="highlight"><pre>
<span></span><span class="n">os</span><span class="o">.</span><span class="n">remove</span><span class="p">(</span><span class="s1">&#39;text.txt&#39;</span><span class="p">)</span>
</pre></div>
</div>
</div>
</div>
</div>
</div>


          </div>
        </div>
      </div>
      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
        <div class="sphinxsidebarwrapper">
  <h3><a href="../index.html">Table of Contents</a></h3>
  <ul>
<li><a class="reference internal" href="#">Introduction to atomman: Basic support and analysis tools</a><ul>
<li><a class="reference internal" href="#1.-Introduction">1. Introduction</a></li>
<li><a class="reference internal" href="#2.-Elastic-constants">2. Elastic constants</a></li>
<li><a class="reference internal" href="#3.-Relative-distances-between-atoms">3. Relative distances between atoms</a><ul>
<li><a class="reference internal" href="#3.1.-System.dvect()">3.1. System.dvect()</a></li>
<li><a class="reference internal" href="#3.2.-System.dmag()">3.2. System.dmag()</a></li>
<li><a class="reference internal" href="#3.3.-displacement()">3.3. displacement()</a></li>
<li><a class="reference internal" href="#3.4.-System.neighborlist()">3.4. System.neighborlist()</a></li>
</ul>
</li>
<li><a class="reference internal" href="#4.-Region-selectors">4. Region selectors</a></li>
<li><a class="reference internal" href="#5.-Basic-tools">5. Basic tools</a><ul>
<li><a class="reference internal" href="#5.1.-Atomic-information">5.1. Atomic information</a></li>
<li><a class="reference internal" href="#5.2.-axes_check()">5.2. axes_check()</a></li>
<li><a class="reference internal" href="#5.3.-filltemplate()">5.3. filltemplate()</a></li>
<li><a class="reference internal" href="#5.4.-indexstr()">5.4. indexstr()</a></li>
<li><a class="reference internal" href="#5.5.-uber_open_rmode">5.5. uber_open_rmode</a></li>
<li><a class="reference internal" href="#5.6.-vect_angle()">5.6. vect_angle()</a></li>
<li><a class="reference internal" href="#5.7.-duplicates_allclose()">5.7. duplicates_allclose()</a></li>
<li><a class="reference internal" href="#5.8.-Miller-index-conversions">5.8. Miller index conversions</a></li>
<li><a class="reference internal" href="#5.9.-Crystal-lattice-identification">5.9. Crystal lattice identification</a></li>
<li><a class="reference internal" href="#5.10.-compositionstr()">5.10. compositionstr()</a></li>
</ul>
</li>
</ul>
</li>
</ul>

  <h4>Previous topic</h4>
  <p class="topless"><a href="2.2._Running_LAMMPS_and_the_Log_class.html"
                        title="previous chapter">Introduction to atomman: Running LAMMPS and the Log class</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="3.1._ElasticConstants_class.html"
                        title="next chapter">Introduction to atomman: ElasticConstants class</a></p>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="3.1._ElasticConstants_class.html" title="Introduction to atomman: ElasticConstants class"
             >next</a> |</li>
        <li class="right" >
          <a href="2.2._Running_LAMMPS_and_the_Log_class.html" title="Introduction to atomman: Running LAMMPS and the Log class"
             >previous</a> |</li>
        <li class="nav-item nav-item-0"><a href="../index.html">atomman 1.4.0 documentation</a> &#187;</li>
          <li class="nav-item nav-item-1"><a href="index.html" >Tutorials</a> &#187;</li> 
      </ul>
    </div>
    <div class="footer" role="contentinfo">
      Created using <a href="http://sphinx-doc.org/">Sphinx</a> 2.2.0.
    </div>
  </body>
</html>